<!DOCTYPE html>
<html lang="en">
<script src="/resources/js/jquery-1.7.1.min.js" type="application/javascript"></script>
<script src="/resources/js/jquery-ui-1.8.10.custom.min.js" type="text/css"></script>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        ul li{

            list-style: none;

        }
        .im-page{
            width: 441px;
            overflow: hidden;
            /*margin: 0 auto;
            margin-top: 25px;*/
        }
        .im-page li{
            float: left;
            height: 25px;
            line-height: 25px;
            text-align: center;
        }
        .im-page li a{
            border-right: 1px solid #ff6500;
            padding: 5px 7px;
            color: #ff6500;
            margin-left: 20px;/*设置标签 a 之间的间隔*/
            text-decoration: none;/*去除页码数字下面的下划线*/
            width: 200px;
        }
        .sousuo{
            background-color: #4affff;
        }
        .zuo{
            width: 260px;
            height:260px;
        }

        .you{
            width: 260px;
            height:260px;
        }

        /*.im-table{
            border: 1px solid #ddd;
            width:1520px;
            height:420px;
        }*/
        .biao{

            width:100%;
            /*height:340px;*/
        }
        .im-page{
            position: absolute;
            left: 37%;
            top: 660px;
        }
        .im-table{
            position: absolute;
            left: 0px;
            top: 250px;
        }
        .im-table tr{
            width: 2500px;
        }
        .zuo{
            position: absolute;
            left: 25%;
        }
        .you {
            position: absolute;
            left: 55%;

        }

       /* .zuo span{
            position: absolute;
            left: 200px;
        }*/

        table{border-collapse:collapse;
            background-color: rgba(229, 255, 151, 0.69)
        }
        } /*合并间距*/
        table,table th,table td{border:1px solid #ddd} /*表格带线框,6像素的间距*/
        table th,table td{padding:2px} /*单元格6像素的间距*/
        table th{background-color:#AAAAFF} /*表头带背景色*/
        table tr:nth-child(even){background: #f2d898;color:#000}
        table td:nth-child(odd){color:#c00}

        .custom-btn {
            width: 130px;
            height: 40px;
            color: #e0fffa;
            border-radius: 5px;
            padding: 10px 25px;
            font-family: 'Lato', sans-serif;
            font-weight: 500;
            background: transparent;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            display: inline-block;
            box-shadow:inset 2px 2px 2px 0px rgba(255,255,255,1),
            7px 7px 20px 0px rgba(0,0,0,.1),
            4px 4px 5px 0px rgba(0,0,0,.1);
            outline: none;
        }
        .btn-16 {
            border: none;
            color: #000;
        }
        .btn-16:after {
            position: absolute;
            content: "";
            width: 0;
            height: 100%;
            top: 0;
            left: 0;
            direction: rtl;
            z-index: -1;
            box-shadow:
                    -7px -7px 20px 0px #fff9,
                    -4px -4px 5px 0px #fff9,
                    7px 7px 20px 0px #0002,
                    4px 4px 5px 0px #0001;
            transition: all 0.3s ease;
        }
        .btn-16:hover {
            color: #000;
        }
        .btn-16:hover:after {
            left: auto;
            right: 0;
            width: 100%;
        }
        .btn-16:active {
            top: 2px;
        }
        .anniu{

            position: absolute;
            left: 40%;
            top: 200px;
        }
        #quxiao{
            position: absolute;
            top: 220px;
            background-color: #18baff;
            height: 30px;
        }
        body{
            background-color: #fff0e7;
        }
        .white_content {
            position: absolute;
            background: rgba(167, 210, 196, 0.8);
            top: 5%;
            left: 20%;
            width: 800px;
            height: 500px;
            padding: 20px;
            border-radius: 30px;
            border: 3px solid #ccfff1;
            z-index:1002;
            overflow: auto;
        }
        .white_conten_you{
            position: absolute;
            top: 30px;
            left: 450px;

        }
        .description{
            position: absolute;
            left: 50px;
        }
        .kuang{
            position: absolute;
            top: 50%;
        }
        .aa{
            position: absolute;
            top: 600px;
            left: 400px;
        }
    </style>

</head>
<body>
<div class="sousuo">
    <form class="form-b" action="" id="form1">
        <div class="zuo">
            <div>
                <input type="text" placeholder="请输入药品流水号" style="width: 220px"  name="serialNumber" />
            </div>

            <div>
                <input type="text" placeholder="请输入剂型" style="width: 220px"  name="dosageForm" />
            </div>

            <div>
                <input type="text" placeholder="请输入单位" style="width: 220px"  name="unit" />
            </div>

            <div>
                <input type="text" placeholder="请输入生产企业" style="width: 220px"  name="productionName" />
            </div>

            <div class="jiage">
                <span>价格范围：</span><input type="text" style="width: 50px" name="winPriceMin" />
                至：<input type="text" style="width: 50px" name="winPriceMax" />
            </div>

            <div>
                药品类别：<select name="drugCategory" class="province" id="leibie" style="width: 145px; height: 25px" >
                <option value="">请选择</option>
                <option value="1">抗生素类药品</option>
                <option value="2">心脑血管用药</option>
                <option value="3">消化系统用药 </option>
                <option value="4">呼吸系统用药</option>
                <option value="5">泌尿系统用药</option>
                <option value="6">血液系统用药</option>
                <option value="7">五官科用药</option>
                <option value="8">抗风湿类药品</option>
                <option value="9">注射剂类药品</option>
                <option value="10">糖尿病用药</option>
                <option value="11">激素类药品</option>
                <option value="12">皮肤科用药</option>
                <option value="13">妇科用药</option>
                <option value="14">抗肿瘤用药</option>
                <option value="15">抗精神病药品</option>
                <option value="16">清热解毒药品</option>
                <option value="17">受体激动\阻断药和抗过敏药</option>
                <option value="18">滋补类药品</option>
                <option value="19">维生素、矿物质药品</option>



            </select>

            </div>
            <div>
                供应商：<select name="providerName" class="province" id="providerName" style="width: 145px; height: 25px" >
                <option value="">请选择</option>
            </select>

            </div>
        </div>
        <div class="you">
            <div>
                <input type="text"  placeholder="请输入通用名" style="width: 220px"  name="commonName" />
            </div>

            <div>
                <input type="text" placeholder="请输入规格" style="width: 220px"  name="size" />
            </div>

            <div>
                <input type="text" placeholder="请输入转换系数" style="width: 220px" name="factor" />
            </div>

            <div class="xishu">
                <input type="text" placeholder="请输入商品名"  style="width: 220px" name="commodityName" />
            </div>
            <div>
                质量层次：<select name="quality" class="province" id="leibie" style="width: 145px; height: 25px" >
                    <option value="">请选择</option>
                    <option value="1">国家一类新药</option>
                    <option value="2">国家科学进步奖</option>
                    <option value="3">专利</option>
                    <option value="4">原研</option>
                    <option value="5">单独定价</option>
                    <option value="6">优质优价</option>
                    <option value="7">GMP</option>
                </select>
            </div>
            <div>
                交易状态：<select name="transaction" class="province" id="leibie" style="width: 145px; height: 25px" >
                    <option value="">请选择</option>
                    <option value="1">正常</option>
                    <option value="2">暂停交易</option>
                </select>
            </div>
            <div>
                审核状态：<select name="controlState" class="province" id="leibie" style="width: 145px; height: 25px" >
                <option value="">请选择</option>
                <option value="1">审核通过</option>
                <option value="2">审核未通过</option>
            </select>

            </div>

        </div>
        <div class="anniu">
            <input class="custom-btn btn-16" type="button" onclick="qugongcha(1)" value="查询" />
            &nbsp;&nbsp;&nbsp;
            <input class="custom-btn btn-16" type="button" onclick="daochu()" value="导出" />
        </div>
    </form>
</div>
<div class="im-table">
    <table class="biao">
        <thead>
        <tr style="height: 60px">
            <th class="w1">序号</th>
            <th class="w2"><input class="checkMax" onclick="checkMax()" type="checkbox" value="">
                全选</th>
            <th class="w3">流水号</th>
            <th class="w4">通用名</th>
            <th class="w5">剂型</th>
            <th class="w6">规格</th>
            <th class="w7">单位</th>
            <th class="w8">转换系数</th>
            <th class="w9">生产企业</th>
            <th class="w10">商品名</th>
            <th class="w11">中标价</th>
            <th class="w12">质量层次</th>
            <th class="w13">药品类别</th>
            <th class="w14">药品交易状态</th>
            <th class="w15">供货商</th>
            <th class="w16">审核状态</th>
            <th class="w17">修改</th>
            <th class="w18">详细</th>

        </tr>
        </thead>
        <tbody id="tbody">
        <tr >

        </tr>
        </tbody>
    </table>
</div>
<div class="im-page">
    <ul id="pages">
        <li class="im-indexpage"><a href="">首页</a></li>
        <li class="im-nextpage"><a href="">上一页</a></li>
        <li class="im-nextpage"><a href="">下一页</a></li>
        <li class="im-indexpage"><a href="">尾页</a></li>
    </ul>
</div>
<div id="light" class="white_content" style="display: none">
    <div></div>
    <div class="white_conten_zuo">
        <div>
            流水号:<input type="text" placeholder="" style="width: 220px"  name="liusui" disabled="true" />
        </div>
        <br>
        <div>
            通用名:<input type="text" style="width: 220px"  name="tongyong" disabled="true" />
        </div>
        <br>
        <div>
            规格:<input type="text" style="width: 220px"  name="guige" disabled="true" />
        </div>
        <br>
        <div>
            转换系数:<input type="text" style="width: 220px" name="xisu" disabled="true" />
        </div>
        <br>
        <div class="xishu">
            商品名:<input type="text"  style="width: 220px" name="shangpinming" />
        </div><br>
        <div >
            批准文号:<input type="text"  style="width: 220px" name="wenhao" />
        </div><br>
        <div class="xishu">
            是否进口药:
            是：<input type="radio" value="1" name="jinkou"/>
            否：<input type="radio" value="2" name="jinkou"/>
        </div><br>
        <div class="xishu">
            包装单位:<input type="text"  style="width: 220px" name="baozhuang" />
        </div><br>
        <div class="xishu">
            零售价出处:<input type="text"  style="width: 220px" name="chucu" />
        </div><br>
        <div class="xishu">
            质量层次说明:<input type="text"  style="width: 220px" name="cengcishuoming" />
        </div>
        <br>
        <div class="xishu">
            药品检验报告编号:<input type="text"  style="width: 220px" name="baogaobianhao" />
        </div>
    </div>
    <div class="white_conten_you">
        <div>
            剂型：<input type="text" style="width: 220px"  name="jixing" disabled="true" />
        </div>
        <br>
        <div>
            单位：<input type="text" style="width: 220px"  name="danWei" disabled="true" />
        </div>
        <br>
        <div>
            生产企业：<input type="text" style="width: 220px"  name="qiye" disabled="true" />
        </div>
        <br>
        <div >
            中标价：<input type="text" style="width: 220px" name="zhongbiaojia" disabled="true">
        </div>
        <br>
        <div>
            批准文号有效期:<input type="date"  style="width: 220px" name="wenhaoqi" />
        </div>
        <br>
        <div >
            包装材质:<input type="text"  style="width: 220px" name="caizhi" />
        </div>
        <br>
        <div>
            最新零售价:<input type="text"  style="width: 220px" name="lingshoujia" />
        </div>
        <br>
        <div>
            质量层次：<select name="cengci" class="province" id="leibie" style="width: 145px; height: 25px" >
            <option value="">请选择</option>
            <option value="1">国家一类新药</option>
            <option value="2">国家科学进步奖</option>
            <option value="3">专利</option>
            <option value="4">原研</option>
            <option value="5">单独定价</option>
            <option value="6">优质优价</option>
            <option value="7">GMP</option>
        </select>
        </div>
        <br>
        <div>
            有无药品检验报告:
            有：<input type="radio" value="1" name="jianyanbaogao"/>
            无：<input type="radio" value="2" name="jianyanbaogao"/>
        </div>
        <br>
        <div class="xishu">
            药品检验报告有效期:<input type="date"  style="width: 220px" name="baogaoqi" />
        </div>
    </div>
    <div class="description">
        产品说明：<textarea class="kuang" name="txt" clos=",50" rows="5" warp="virtual" style="width: 600px"></textarea>
    </div>

    <br><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <div class="aa">
    <input type="button" onclick="gai()" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'" value="关闭" />
    </div>
    　　　</div>
<div id="fade" class="black_overlay"></div>
</body>
<script type="text/javascript">
    $(function () {
        qugongcha(1);


        $.getJSON("/provider/providerName",{},function (data) {
            $("#providerName").empty();
            var providerName='<option value="">请选择</option>';
            for(var i=0;i<data.length;i++){
                var qiyename=data[i];
                providerName+='<option value="'+qiyename.providerName+'">'+qiyename.providerName+'</option>';
            }
            $("#providerName").append(providerName);
        })
    });
    var Sid=1;

    //全部导出
    function daochu() {
        location.href="/provider/maintainexcel";
    }
    //弹窗
    var xiuid=0;
    function tanchuang(id) {
        $.ajax({
            url:"/provider/weixiu",
            data:{"id":id},
            type:"post",
            async:false,
            traditional:true,
            success:function (data) {
                $("input[name='liusui']").val(data[0].serialNumber);
                $("input[name='tongyong']").val(data[0].commonName);
                $("input[name='guige']").val(data[0].dosageForm);
                $("input[name='xisu']").val(data[0].factor);
                $("input[name='shangpinming']").val(data[0].productionName);
                $("input[name='wenhao']").val(data[0].approvalNumber);
                if(data[0].isImport==1){
                    $("[name='jinkou']").get(0).checked=true;
                }else {
                    $("[name='jinkou']").get(1).checked=true;
                }
                $("input[name='baozhuang']").val(data[0].packageUnit);
                $("input[name='chucu']").val(data[0].priceSource);
                $("input[name='cengcishuoming']").val(data[0].qualityDescription);
                $("input[name='baogaobianhao']").val(data[0].reportNum);
                $("input[name='jixing']").val(data[0].dosageForm);
                $("input[name='danWei']").val(data[0].unit);
                $("input[name='qiye']").val(data[0].productionName);
                $("input[name='zhongbiaojia']").val(data[0].winPrice);
                $("input[name='wenhaoqi']").val("");
                if(data[0].approvalDate !=="" && data[0].approvalDate !==null){
                    var d = data[0].approvalDate;
                    $("input[name='wenhaoqi']").val(d.substring(0,10));
                }
                $("input[name='caizhi']").val(data[0].packages);
                $("input[name='lingshoujia']").val(data[0].newPrice);

                if(data[0].haveReport==1){
                    $("[name='jianyanbaogao']").get(0).checked=true;
                }else {
                    $("[name='jianyanbaogao']").get(1).checked=true;
                }
                $("select[name='cengci']").val(data[0].quality);
                $("input[name='baogaoqi']").val("");
                if(data[0].reportDate !=="" && data[0].reportDate !==null){
                    var d = data[0].reportDate;
                    $("input[name='baogaoqi']").val(d.substring(0,10));
                }
                $("textarea[name='txt']").val(data[0].productionDescription);

            }
        });
        xiuid=id;
        document.getElementById('light').style.display='block'
    }

    /*模糊查询*/
    function qugongcha(pageNum) {
        if(pageNum==0){
            pageNum=1;
        }
        var formData=$("#form1").serialize();
        formData+="&pageNum="+pageNum;
        $.ajax({
            url:"/provider/maintain",
            data:formData,
            dataType:"json",
            type:"post",
            success:function (data) {
                var tbody='';
                var list=data.list;
                $("#tbody").empty();
                for (var i=0;i<list.length;i++){
                    var smp=list[i];
                    /* for (b=0;b<smp.length;b++){
                         if(smp[b]==null && smp[b].equals("")){
                             smp[b]="";
                         }
                     }*/
                    var zhuangtai="";
                    if(smp.transaction==1){
                        zhuangtai="正常";
                    }else{
                        zhuangtai="暂停交易";
                    }
                    var jigouzhuangtai="";
                    if(smp.controlState==1){
                        jigouzhuangtai="审核通过";
                    }else{
                        jigouzhuangtai="审核未通过";
                    }
                    tbody+='<tr style="height: 60px">' +
                        '            <td class="w1">'+(i+1)+'</td>\n' +
                        '            <td class="w2"><input class="checkMin" onclick="checkMin()" value="'+smp.id+'" type="checkbox"></td>' +
                        '            <td class="w3">'+smp.serialNumber+'</td>' +
                        '            <td class="w4">'+smp.commonName+'</td>' +
                        '            <td class="w5">'+smp.dosageForm+'</td>' +
                        '            <td class="w6">'+smp.size+'</td>' +
                        '            <td class="w7">'+smp.unit+'</td>' +
                        '            <td class="w8">'+smp.factor+'</td>' +
                        '            <td class="w9">'+smp.productionName+'</td>' +
                        '            <td class="w10">'+smp.commodityName+'</td>' +
                        '            <td class="w11">'+smp.winPrice+'</td>' +
                        '            <td class="w12">'+smp.dataName+'</td>' +
                        '            <td class="w13">'+smp.category+'</td>' +
                        '            <td class="w14">'+zhuangtai+'</td>' +
                        '        <td class="w15">'+smp.providerName+'</td>' +
                        '        <td class="w16">'+jigouzhuangtai+'</td>' +
                        '        <td class="w17"><button class="custom-btn btn-16" onclick="tanchuang('+smp.id+')">修改</button></td>'+
                        '            <td class="w18"><button class="custom-btn btn-16"><a href="Particular.html?Sid='+smp.id+'">查看</a></button></td></tr>'

                }

                $("#tbody").append(tbody);
                $("#pages").empty();
                var pages=' <li class="im-indexpage"><a href="javaScript:qugongcha('+1+')">首页</a></li>\n' +
                    '        <li class="im-nextpage"><a href="javaScript:qugongcha('+data.prePage+')">上一页</a></li>\n' +
                    '        <li class="im-nextpage"><a href="javaScript:qugongcha('+data.nextPage+')">下一页</a></li>\n' +
                    '        <li class="im-indexpage"><a href="javaScript:qugongcha('+data.pages+')">尾页</a></li>';
                $("#pages").append(pages);
            }
        })
    }
    function gai() {
        var pojo={

            id:xiuid,
            serialNumber:$("input[name='liusui']").val(),
            commonName:$("input[name='tongyong']").val(),
            size:$("input[name='guige']").val(),
            factor:$("input[name='xisu']").val(),
            commodityName:$("input[name='shangpinming']").val(),
            approvalNumber:$("input[name='wenhao']").val(),
            isImport:$("input[name='jinkou']").val(),
            packageUnit:$("input[name='baozhuang']").val(),
            priceSource:$("input[name='chucu']").val(),
            qualityDescription:$("input[name='cengcishuoming']").val(),
            reportNum:$("input[name='baogaobianhao']").val(),
            dosageForm:$("input[name='jixing']").val(),
            unit:$("input[name='danWei']").val(),
            productionName:$("input[name='qiye']").val(),
            winPrice:$("input[name='zhongbiaojia']").val(),
            packages:$("input[name='caizhi']").val(),
            newPrice:$("input[name='lingshoujia']").val(),
            haveReport:$("input[name='jianyanbaogao']").val(),
            quality:$("select[name='cengci']").val(),
            approvalDate:$("input[name='wenhaoqi']").val(),
            reportDate:$("input[name='baogaoqi']").val(),
            productionDescription:$("textarea[name='txt']").val()

        };

        console.log(pojo);
        $.ajax({
            url:"/provider/update",
            data:{JsonPojo:JSON.stringify(pojo)},
            dataType:"json",
            type:"post",
            cache: false,
            success:function (data) {
                alert(data);
            }
        });
        alert("提交成功！")
    }
</script>
</html>